package com.iyeed.jbpm04.demo03.taskevent;

import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.exe.TaskInstance;
import org.junit.Test;

public class TaskEventTest {

	@Test
	public void testTaskEvent() {
		JbpmContext jcontext = JbpmConfiguration.getInstance().createJbpmContext();
		try {
			ProcessInstance pi = jcontext.newProcessInstance("taskeventprocess");
			pi.signal();
			
			TaskInstance ti = (TaskInstance) pi.getTaskMgmtInstance().getTaskInstances().iterator().next();
			ti.start();
			ti.end();
		} finally {
			if (jcontext != null) {
				jcontext.close();
			}
		}
	}
	
}
